import logging

from redis import StrictRedis


class Config(object):
    """工程配置信息"""
    SQLALCHEMY_DATABASE_URI = "mysql+mysqlconnector://root:lj521wei@127.0.0.1:3306/information"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = "6379"

    SESSION_TYPE = "redis"
    SESSION_USE_SIGNER = True
    SESSION_PERMANENT = False
    PERMANENT_SESSION_LIFETIME = 86400 * 2
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SECRET_KEY = "hfgfdjfdhjkfdhfj" # 此处的值由bytes.decode(base64.b64encode(os.urandom(48)))这个命令生成的随机值

    LOG_LEVEL = logging.DEBUG

class DevelopementConfig(Config):
    DEBUG = True


class ProductionConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.ERROR


config = {
    "dev" : DevelopementConfig,
    "pro" : ProductionConfig
}